package top.gbyun.core.api;

import akka.actor.ActorContext;
import top.gbyun.core.msg.NodeMsg;

/**
 * @author gengbin
 * @date 2024-12-24-15:16
 */
public interface NodeContext {
    /**
     * Sends message to all Rule Nodes in the Rule Chain
     * that are connected to the current Rule Node using specified relationType.
     *
     * @param msg
     */
    void send(NodeMsg msg);

    /**
     * Sends message to the current Rule Node with specified delay in milliseconds.
     * Note: this message is not queued and may be lost in case of a server restart.
     *
     * @param msg
     */
    void tellSelf(NodeMsg msg, long delayMs);

    /**
     * Notifies Rule Engine about failure to process current message.
     *
     * @param msg - message
     * @param th  - exception
     */
    void tellFailure(NodeMsg msg, Throwable th);

    void ack(NodeMsg engineMsg);

    ActorContext getActorContext();
}
